import React,{Component} from 'react'
import {Form,Input,Button} from 'antd'

const {Item} = Form
class SearchForm extends Component{
    
    handleSubmit = e=> {
        e.preventDefault()
        const form  = this.props.form

        form.validateFields(async (err, values) => {
            if(!err){
                console.log("Received:",values)
                
            } else {
                // alert("用户名或密码输入错误")
            }
        }
        )

    }

    render (){
        
        const {getFieldDecorator} = this.props.form
        return (
            <Form onSubmit={this.handleSubmit} className="form" layout="inline" >
                    
                    
                    <Item  name="name" label="姓名">
                    
                         {
                        getFieldDecorator('name',{
                            initialValue:"",
                            rules:[
                                
                                {required: true, whitespace: true, message: "请输入活动名称"},
                                {max: 200, message: "字段长度信息不能多于200个字符"},
                            ]
                        })(
                            <Input/>
                        )
                        }

                    </Item>
                    <Item style={{float:"right"}}>
                        <Button type="primary" htmlType="submit"  className="form-submit">
                            查询
                        </Button>
                    </Item>
                </Form>
           )
    }
}

const WrapperForm = Form.create()(SearchForm)
export default WrapperForm